]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Add purpose hint getter to KeyboardController
authorCarlos Garnacho <carlosg@gnome.org>
Sat, 31 May 2025 11:24:33 +0000 (13:24 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 31 May 2025 12:30:39 +0000 (14:30 +0200)
This is the interface between the Keyboard widgetry and the input
method, add a getter so we can ask for the current purpose hint,
and initialize it from the current IM state in the constructor so
we can query it right away.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3733>

js/ui/keyboard.js

index 08346d35364d8ec53d71680222674a0c740329a4..fc21011d39cdd3c081ff4956e1f180f5a87d63c7 100644 (file)
@@ -1994,6 +1994,7 @@ class KeyboardController extends Signals.EventEmitter {
             'current-source-changed', this._onSourceChanged.bind(this),
             'sources-changed', this._onSourcesModified.bind(this), this);
         this._currentSource = this._inputSourceManager.currentSource;
+        this._purpose = Main.inputMethod.contentPurpose;
 
         Main.inputMethod.connectObject(
             'notify::content-purpose', this._onPurposeHintsChanged.bind(this),
@@ -2001,6 +2002,10 @@ class KeyboardController extends Signals.EventEmitter {
             'input-panel-state', (o, state) => this.emit('panel-state', state), this);
     }
 
+    get purpose() {
+        return this._purpose;
+    }
+
     destroy() {
         this._inputSourceManager.disconnectObject(this);
         Main.inputMethod.disconnectObject(this);